package com.icode.mvc.controller.key;

/**
 * User: Alex Zhong
 * Date: 2016/2/3
 */
public class SimpleKey implements Key {
    private String value;

    public SimpleKey(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof SimpleKey)) return false;

        SimpleKey simpleKey = (SimpleKey) o;

        if (!value.equals(simpleKey.value)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return value.hashCode();
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("SimpleKey{");
        sb.append("value='").append(value).append('\'');
        sb.append('}');
        return sb.toString();
    }
}
